<template>
 <div>
<el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/welcome' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>日志管理</el-breadcrumb-item>
      <el-breadcrumb-item>日志信息</el-breadcrumb-item>
    </el-breadcrumb>
<el-card>
 <el-alert title="展示服务列表" type="info" show-icon> </el-alert>
<el-table :data="requestloglist" border style="width: 100%">
<el-table-column type="index"> </el-table-column>
 <el-table-column prop="serverName" label="服务名称" width="180">
          </el-table-column>
          <el-table-column prop="requestPort" label="服务名称" width="180">
          </el-table-column> 
          <el-table-column
            prop="requestCreateTime"
            label="创建时间"
            width="180"
            :formatter="dateFormat"
          >
          </el-table-column> 
          <el-table-column prop="requestName" label="请求路径" width="180">
          </el-table-column> 

          <el-table-column prop="requestParams" label="详细参数" width="180">
          </el-table-column> 

</el-table>
<!-- 分页插件-->
<el-pagination

  @current-change="handleCurrentChange"
  
  :page-size="5"
  :pager-count="15"
  layout="prev, pager, next"
  :total="total">
</el-pagination>


</el-card>


 </div>
</template>

<script>
//对外暴露接口
 export default {
name:'logs', 
   data () {
     return {
         requestloglist:[],
         total:0

     }
   },
   components: {

   },
   mounted() {
       this.GetResuestlogBypage(1,10)
   },
   methods: {
       dateFormat(row, column) {
      let date = row[column.property];

      if (date === undefined) {
        return row[column.property];
      }
      let datetime = new Date(date).toLocaleDateString();

      return datetime;
    },
    GetResuestlogBypage(pagenum,count){
         let that = this;
         let url = "api/GetRequestLogByPage";
         let data = {
             pagenum:pagenum,
             count:count
         }
         this.$axios.post(url, this.$qs.stringify(data)).then(function(Response) {
        console.log(Response.data);
        let message = Response.data.message;
        let code = Response.data.code;
        let data = Response.data.data;
        if (code == 200) {
          that.total = data.total
          that.requestloglist = data.records;
          that.$message.success(message);
        } else {
          that.$message.error(message);
         
        }
      });


    },
    handleCurrentChange(val){
      this.GetResuestlogBypage(val,10)

    }
       
   },
 }
</script>

<style scoped>

 
</style>
